
cd "/Users/chuangchen/Library/CloudStorage/OneDrive-UniversityofPittsburgh/Pela project"


use "/Users/chuangchen/Library/CloudStorage/OneDrive-UniversityofPittsburgh/LASA/Datos/all_countries3.dta", clear


* recode the same-sex marriage question
* moral conservative
gen pro_ssm= 0 if val_ssm <=3
* moral middle
replace pro_ssm=1 if val_ssm <=7 & val_ssm>3
* moral progressive
replace pro_ssm=2 if val_ssm >7
replace pro_ssm=. if val_ssm >10
lab value pro_ssm pro_abort_lab

gen eco_moral4 = 1 if pro_ssm == 0 & pro_regulation2==0
replace eco_moral4 = 2 if pro_ssm == 0 & pro_regulation2==1
replace eco_moral4 = 3 if pro_ssm == 0 & pro_regulation2==2
replace eco_moral4 = 4 if pro_ssm == 1 & pro_regulation2==0
replace eco_moral4 = 5 if pro_ssm == 1 & pro_regulation2==1
replace eco_moral4 = 6 if pro_ssm == 1 & pro_regulation2==2
replace eco_moral4 = 7 if pro_ssm == 2 & pro_regulation2==0
replace eco_moral4 = 8 if pro_ssm == 2 & pro_regulation2==1
replace eco_moral4 = 9 if pro_ssm == 2 & pro_regulation2==2
lab value eco_moral4 eco_moral2_lab


lab variable pid_p "PID"

gen eco_moral_recode=.

replace eco_moral_recode=eco_moral2
lab value eco_moral_recode eco_moral2_lab
est clear
tab party_family if party_family!=. & eco_moral_recode!=.

* Model 1, moral is abortion
eststo: mlogit party_family ib5.eco_moral_recode i.age_party_recode age N_party_member female education religious i.wave i.pais_n, vce(cluster partido) base(2)
margins, at(eco_moral_recode=(1(1)9)) saving("model1_pred_prob.dta")



* Model 2, moral is ssm
replace eco_moral_recode=eco_moral4
tab party_family if party_family!=. & eco_moral_recode!=.
eststo: mlogit party_family ib5.eco_moral_recode i.age_party_recode age N_party_member female education religious i.wave i.pais_n, vce(cluster partido) base(2)

margins, at(eco_moral_recode=(1(1)9)) saving("model2_pred_prob.dta")

esttab using "Models1_2.tex", drop(_cons *wave *pais_n) wide pr2 aic aux(se) scalars("ll Log lik.") star(+ 0.10 * 0.05 ** 0.01 *** 0.001) b(3) label varwidth(33) interaction("$\times$") mtitles("Model 1" "Model 2") nobaselevels unstack nodepvars noomitted replace 






